package com.jy.modules.cims.component.common.service;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jy.modules.cims.data.common.dao.TCMmTransExceptionDao;
import com.jy.modules.cims.data.common.dto.TCMmTransExceptionDTO;
import com.jy.platform.core.common.BaseDTO;

/**
 * @classname: TCMmTransExceptionService
 * @description: 定义  事务异常处理表 实现类
 * @author:  jieyue
 */
@Service("com.jy.modules.cims.component.common.service.TCMmTransExceptionService")
public class TCMmTransExceptionService implements Serializable {

    private static final long serialVersionUID = 1L;
    
	@Autowired
	private TCMmTransExceptionDao dao;

	/**
     * @author jieyue
     * @description: 分页查询 事务异常处理表列表
     * @date 2015-12-15 16:46:14
     * @param searchParams 条件
     * @return
     * @throws
     */ 
	public List<TCMmTransExceptionDTO> searchTCMmTransExceptionByPaging(Map<String,Object> searchParams) throws Exception {
		List<TCMmTransExceptionDTO> dataList =  dao.searchTCMmTransExceptionByPaging(searchParams);
		return dataList;
	}
	/**
     * @author jieyue
     * @description: 按条件查询事务异常处理表列表
     * @date 2015-12-15 16:46:14
     * @param searchParams 条件
     * @return
     * @throws
     */
	public List<TCMmTransExceptionDTO> searchTCMmTransException(Map<String,Object> searchParams) throws Exception {
	    List<TCMmTransExceptionDTO> dataList = dao.searchTCMmTransException(searchParams);
        return dataList;
    }
	/**
     * @author jieyue
     * @description: 查询事务异常处理表对象
     * @date 2015-12-15 16:46:14
     * @param id
     * @return
     * @throws
     */ 
	public TCMmTransExceptionDTO queryTCMmTransExceptionByPrimaryKey(String id) throws Exception {
		
		TCMmTransExceptionDTO dto = dao.findTCMmTransExceptionByPrimaryKey(id);
		
		if(dto == null) dto = new TCMmTransExceptionDTO();
		
		return dto;
		
	}

	/**
     * @title: insertTCMmTransException
     * @author jieyue
     * @description: 新增 事务异常处理表对象
     * @date 2015-12-15 16:46:14
     * @param dto
     * @return
     * @throws
     */
	@SuppressWarnings("all")
	public Long insertTCMmTransException(TCMmTransExceptionDTO dto) throws Exception {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", dto);
		
		int count = dao.insertTCMmTransException(paramMap);
		
		TCMmTransExceptionDTO resultDto = (TCMmTransExceptionDTO) paramMap.get("dto");
		Long keyId = resultDto.getId();
		return keyId;
	}
	/**
     * @title: updateTCMmTransException
     * @author jieyue
     * @description: 修改 事务异常处理表对象
     * @date 2015-12-15 16:46:14
     * @param paramMap
     * @return
     * @throws
     */
	public void updateTCMmTransException(TCMmTransExceptionDTO dto) throws Exception {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", dto);
		
		dao.updateTCMmTransException(paramMap);
	}
	/**
     * @title: deleteTCMmTransExceptionByPrimaryKey
     * @author jieyue
     * @description: 删除 事务异常处理表,按主键
     * @date 2015-12-15 16:46:14
     * @param paramMap
     * @throws
     */ 
	public void deleteTCMmTransExceptionByPrimaryKey(BaseDTO baseDto,String ids) throws Exception {
		if(StringUtils.isEmpty(ids)) throw new Exception("删除失败！传入的参数主键为null");
		
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", baseDto);
		paramMap.put("ids", ids);
		dao.deleteTCMmTransExceptionByPrimaryKey(paramMap);
	}
	
	/**
     * @author jieyue
     * @description: 按主键删除事务异常处理表
     * @date 2015-12-15 16:46:14
     * @param ids
     * @return
     */ 
    public void deleteTCMmTransExceptionByID(Long ids) throws Exception {
    	Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("ids", ids);
		dao.deleteTCMmTransExceptionByID(paramMap);
    }
    
}

